package cn.gson.boot.model.pojos;

import javax.persistence.*;
import java.sql.Timestamp;
import java.util.List;
import java.util.Objects;

@Entity
@Table(name = "kehu", schema = "boot", catalog = "")
//客户表
public class Kehu {
    private int kId;//客户id
    private String kName;//客户名称
    private String kJname;//客户简称
    private String kType;//客户type种类
    private String kFuzei;//客户负责人
    private String kSmzq;//客户生命周期
    private String kLaiy;//客户来源
    private Timestamp kCsjian;//客户创建时间
    private Timestamp kXsjian;//客户更新时间
    private String kDxing;//客户定性
    private String kJied;//客户节点
    private Integer kTchi;//客户停滞天数
    private String kBeizhu;//备注
    private String kSheng;//省
    private String kShi;//市
    private String kQu;//区
    private String kGongsid;//详细地址
    private int kZtai;//状态

    private User empId;//用户

    private List<Contacts> contacts;//联系人集合
    private List<Hetong> hetong;//合同集合
    private List<Dingdan> dingdan;//订单集合

    private List<Business> businesses;//出差集合

    //多个客户有一个负责人
    @ManyToOne
    @JoinColumn(name = "emp_id", nullable = true)
    public User getEmpId() {
        return empId;
    }

    public void setEmpId(User empId) {
        this.empId = empId;
    }

    //一个客户有多个联系人
    @OneToMany(mappedBy = "kId")
    public List<Contacts> getContacts() {
        return contacts;
    }

    public void setContacts(List<Contacts> contacts) {
        this.contacts = contacts;
    }

    //一个客户有多个合同
    @OneToMany(mappedBy = "kH")
    public List<Hetong> getHetong() { return hetong; }

    public void setHetong(List<Hetong> hetong) { this.hetong = hetong; }

    //一个客户有多个订单
    @OneToMany(mappedBy = "kH")
    public List<Dingdan> getDingdan() { return dingdan; }

    public void setDingdan(List<Dingdan> dingdan) { this.dingdan = dingdan; }

    //一个客户有多个出差
    @OneToMany(mappedBy = "kId")
    public List<Business> getBusinesses() {
        return businesses;
    }

    public void setBusinesses(List<Business> businesses) {
        this.businesses = businesses;
    }

    public Kehu(String kName, String kType, String kFuzei, String kSmzq, String kLaiy, Timestamp kCsjian, Timestamp kXsjian, String kDxing, String kJied, Integer kTchi, String kBeizhu) {
        this.kName = kName;
        this.kType = kType;
        this.kFuzei = kFuzei;
        this.kSmzq = kSmzq;
        this.kLaiy = kLaiy;
        this.kCsjian = kCsjian;
        this.kXsjian = kXsjian;
        this.kDxing = kDxing;
        this.kJied = kJied;
        this.kTchi = kTchi;
        this.kBeizhu = kBeizhu;
    }

    public Kehu() {

    }

    public Kehu(int kId) {
        this.kId = kId;
    }

    @Id
    @Column(name = "k_id", nullable = false)
    @GeneratedValue(strategy = GenerationType.IDENTITY,generator = "seq")
    public int getkId() {
        return kId;
    }

    public void setkId(int kId) {
        this.kId = kId;
    }

    @Basic
    @Column(name = "k_name", nullable = true, length = 255)
    public String getkName() {
        return kName;
    }

    public void setkName(String kName) {
        this.kName = kName;
    }

    @Basic
    @Column(name = "k_jname", nullable = true, length = 255)
    public String getkJname() {
        return kJname;
    }

    public void setkJname(String kJname) {
        this.kJname = kJname;
    }

    @Basic
    @Column(name = "k_type", nullable = true, length = 255)
    public String getkType() {
        return kType;
    }

    public void setkType(String kType) {
        this.kType = kType;
    }

    @Basic
    @Column(name = "k_fuzei", nullable = true, length = 255)
    public String getkFuzei() {
        return kFuzei;
    }

    public void setkFuzei(String kFuzei) {
        this.kFuzei = kFuzei;
    }

    @Basic
    @Column(name = "k_smzq", nullable = true, length = 255)
    public String getkSmzq() {
        return kSmzq;
    }

    public void setkSmzq(String kSmzq) {
        this.kSmzq = kSmzq;
    }

    @Basic
    @Column(name = "k_laiy", nullable = true, length = 255)
    public String getkLaiy() {
        return kLaiy;
    }

    public void setkLaiy(String kLaiy) {
        this.kLaiy = kLaiy;
    }

    @Basic
    @Column(name = "k_csjian", nullable = false)
    public Timestamp getkCsjian() {
        return kCsjian;
    }

    public void setkCsjian(Timestamp kCsjian) {
        this.kCsjian = kCsjian;
    }

    @Basic
    @Column(name = "k_xsjian", nullable = false)
    public Timestamp getkXsjian() {
        return kXsjian;
    }

    public void setkXsjian(Timestamp kXsjian) {
        this.kXsjian = kXsjian;
    }

    @Basic
    @Column(name = "k_dxing", nullable = false)
    public String getkDxing() {
        return kDxing;
    }

    public void setkDxing(String kDxing) {
        this.kDxing = kDxing;
    }

    @Basic
    @Column(name = "k_jied", nullable = false)
    public String getkJied() {
        return kJied;
    }

    public void setkJied(String kJied) {
        this.kJied = kJied;
    }

    @Basic
    @Column(name = "k_tchi", nullable = true)
    public Integer getkTchi() {
        return kTchi;
    }

    public void setkTchi(Integer kTchi) {
        this.kTchi = kTchi;
    }


    @Basic
    @Column(name = "k_beizhu", nullable = true)
    public String getkBeizhu() {
        return kBeizhu;
    }

    public void setkBeizhu(String kBeizhu) {
        this.kBeizhu = kBeizhu;
    }

    @Basic
    @Column(name = "k_sheng", nullable = true, length = 255)
    public String getkSheng() {
        return kSheng;
    }

    public void setkSheng(String kSheng) {
        this.kSheng = kSheng;
    }

    @Basic
    @Column(name = "k_shi", nullable = true, length = 255)
    public String getkShi() {
        return kShi;
    }

    public void setkShi(String kShi) {
        this.kShi = kShi;
    }

    @Basic
    @Column(name = "k_qu", nullable = true, length = 255)
    public String getkQu() {
        return kQu;
    }

    public void setkQu(String kQu) {
        this.kQu = kQu;
    }

    @Basic
    @Column(name = "k_gongsid", nullable = true, length = 255)
    public String getkGongsid() {
        return kGongsid;
    }

    public void setkGongsid(String kGongsid) {
        this.kGongsid = kGongsid;
    }

    @Basic
    @Column(name = "k_ztai", nullable = true)
    public int getkZtai() {
        return kZtai;
    }

    public void setkZtai(int kZtai) {
        this.kZtai = kZtai;
    }

    @Override
    public String toString() {
        return "Kehu{" +
                "kId=" + kId +
                ", kName='" + kName + '\'' +
                ", kType='" + kType + '\'' +
                ", kFuzei='" + kFuzei + '\'' +
                ", kSmzq='" + kSmzq + '\'' +
                ", kLaiy='" + kLaiy + '\'' +
                ", kCsjian=" + kCsjian +
                ", kXsjian=" + kXsjian +
                ", kDxing='" + kDxing + '\'' +
                ", kJied='" + kJied + '\'' +
                ", kTchi=" + kTchi +
                '}';
    }
}
